﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace Ruleweaver
{
	[TestFixture]
	public class CharFixture
	{
		[TestCase('A')]
		[TestCase('0')]
		[TestCase(',')]
		public void IsLetterOrDigit(char c)
		{
			Assert.IsTrue(Check.That(c).IsLetterOrDigit() == Char.IsLetterOrDigit(c));
		}

		[TestCase((char) 13)]
		[TestCase(',')]
		public void IsControl(char c)
		{
			Assert.IsTrue(Check.That(c).IsControl() == Char.IsControl(c));
		}

		[TestCase('0')]
		[TestCase(',')]
		public void IsDigit(char c)
		{
			Assert.IsTrue(Check.That(c).IsDigit() == Char.IsDigit(c));
		}

		[TestCase('\uD800')]
		[TestCase(',')]
		public void IsHighSurrogate(char c)
		{
			Assert.IsTrue(Check.That(c).IsHighSurrogate() == Char.IsHighSurrogate(c));
		}

		[TestCase('A')]
		[TestCase(',')]
		public void IsLetter(char c)
		{
			Assert.IsTrue(Check.That(c).IsLetter() == Char.IsLetter(c));
		}

		[TestCase('A')]
		[TestCase('a')]
		public void IsLowerCase(char c)
		{
			Assert.IsTrue(Check.That(c).IsLowerCase() == Char.IsLower(c));
		}

		[TestCase('\uDC00')]
		[TestCase(',')]
		public void IsLowSurrogate(char c)
		{
			Assert.IsTrue(Check.That(c).IsLowSurrogate() == Char.IsLowSurrogate(c));
		}

		[TestCase('0')]
		[TestCase(',')]
		public void IsNumber(char c)
		{
			Assert.IsTrue(Check.That(c).IsNumber() == Char.IsNumber(c));
		}

		[TestCase(',')]
		[TestCase('0')]
		public void IsPunctuation(char c)
		{
			Assert.IsTrue(Check.That(c).IsPunctuation() == Char.IsPunctuation(c));
		}

		[TestCase(' ')]
		[TestCase('A')]
		public void IsSeparator(char c)
		{
			Assert.IsTrue(Check.That(c).IsSeparator() == Char.IsSeparator(c));
		}

		[Test]
		public void IsSurrogatePasses()
		{
			var c = "\U00010F00"[0];

			Assert.IsTrue(Check.That(c).IsSurrogate() == Char.IsSurrogate(c));
		}

		[Test]
		public void IsSurrogateFails()
		{
			Assert.IsTrue(Check.That(',').IsSurrogate() == Char.IsSurrogate(','));
		}

		[TestCase('$')]
		[TestCase(',')]
		public void IsSymbol(char c)
		{
			Assert.IsTrue(Check.That(c).IsSymbol() == Char.IsSymbol(c));
		}

		[TestCase('A')]
		[TestCase('a')]
		public void IsUpperCase(char c)
		{
			Assert.IsTrue(Check.That(c).IsUpperCase() == Char.IsUpper(c));
		}

		[TestCase(' ')]
		[TestCase(',')]
		public void IsWhiteSpace(char c)
		{
			Assert.IsTrue(Check.That(c).IsWhiteSpace() == Char.IsWhiteSpace(c));
		}
	}
}